package c.e.b.h.e.k;

import c.e.a.b.g.g;
import c.e.b.h.e.s.e;
import java.util.Date;
import java.util.concurrent.Callable;

/* compiled from: CrashlyticsController */
public class y implements Callable<g<Void>> {
    public final /* synthetic */ Date a;
    public final /* synthetic */ Throwable b;
    public final /* synthetic */ Thread c;
    public final /* synthetic */ e d;
    public final /* synthetic */ t e;

    public y(t tVar, Date date, Throwable th, Thread thread, e eVar) {
        this.e = tVar;
        this.a = date;
        this.b = th;
        this.c = thread;
        this.d = eVar;
    }

    /* JADX WARNING: Removed duplicated region for block: B:110:0x03f2  */
    /* JADX WARNING: Removed duplicated region for block: B:112:0x03f7  */
    /* JADX WARNING: Removed duplicated region for block: B:116:0x042f  */
    /* JADX WARNING: Removed duplicated region for block: B:115:0x0429  */
    /* JADX WARNING: Removed duplicated region for block: B:107:0x039b A:{Catch:{ all -> 0x037c }} */
    /* JADX WARNING: Removed duplicated region for block: B:110:0x03f2  */
    /* JADX WARNING: Removed duplicated region for block: B:112:0x03f7  */
    /* JADX WARNING: Removed duplicated region for block: B:115:0x0429  */
    /* JADX WARNING: Removed duplicated region for block: B:116:0x042f  */
    /* JADX WARNING: Removed duplicated region for block: B:107:0x039b A:{Catch:{ all -> 0x037c }} */
    /* JADX WARNING: Removed duplicated region for block: B:110:0x03f2  */
    /* JADX WARNING: Removed duplicated region for block: B:112:0x03f7  */
    /* JADX WARNING: Removed duplicated region for block: B:116:0x042f  */
    /* JADX WARNING: Removed duplicated region for block: B:115:0x0429  */
    public java.lang.Object call() throws java.lang.Exception {
        /*
        r35 = this;
        r1 = r35;
        r2 = c.e.b.h.e.b.a;
        r0 = r1.a;
        r3 = r0.getTime();
        r5 = 1000; // 0x3e8 float:1.401E-42 double:4.94E-321;
        r11 = r3 / r5;
        r0 = r1.e;
        r3 = r0.i();
        r0 = 0;
        if (r3 != 0) goto L_0x0022;
    L_0x0017:
        r3 = "Tried to write a fatal exception while no session was open.";
        r2.d(r3);
        r0 = c.e.a.b.b.j.d.b(r0);
        goto L_0x0446;
    L_0x0022:
        r0 = r1.e;
        r0 = r0.c;
        r0.a();
        r0 = r1.e;
        r0 = r0.s;
        r4 = r1.b;
        r5 = r1.c;
        r6 = "";
        r7 = "-";
        r7 = r3.replaceAll(r7, r6);
        java.util.Objects.requireNonNull(r0);
        r8 = new java.lang.StringBuilder;
        r8.<init>();
        r9 = "Persisting fatal event for session ";
        r8.append(r9);
        r8.append(r7);
        r8 = r8.toString();
        r2.b(r8);
        r8 = r0.a;
        r9 = r8.a;
        r9 = r9.getResources();
        r9 = r9.getConfiguration();
        r9 = r9.orientation;
        r10 = new c.e.b.h.e.t.e;
        r13 = r8.d;
        r10.m1844init(r4, r13);
        r4 = java.lang.Long.valueOf(r11);
        r13 = r8.c;
        r13 = r13.d;
        r14 = r8.a;
        r13 = c.e.b.h.e.k.g.h(r13, r14);
        if (r13 == 0) goto L_0x0083;
    L_0x0075:
        r13 = r13.importance;
        r14 = 100;
        if (r13 == r14) goto L_0x007d;
    L_0x007b:
        r13 = 1;
        goto L_0x007e;
    L_0x007d:
        r13 = 0;
    L_0x007e:
        r13 = java.lang.Boolean.valueOf(r13);
        goto L_0x0084;
    L_0x0083:
        r13 = 0;
    L_0x0084:
        r17 = r13;
        r13 = java.lang.Integer.valueOf(r9);
        r14 = new java.util.ArrayList;
        r14.<init>();
        r15 = r10.c;
        r20 = r6;
        r6 = 4;
        r6 = r8.c(r5, r15, r6);
        r14.add(r6);
        r6 = java.lang.Thread.getAllStackTraces();
        r6 = r6.entrySet();
        r6 = r6.iterator();
    L_0x00a7:
        r15 = r6.hasNext();
        if (r15 == 0) goto L_0x00e1;
    L_0x00ad:
        r15 = r6.next();
        r15 = (java.util.Map.Entry) r15;
        r16 = r15.getKey();
        r18 = r6;
        r6 = r16;
        r6 = (java.lang.Thread) r6;
        r16 = r6.equals(r5);
        if (r16 != 0) goto L_0x00da;
    L_0x00c3:
        r16 = r5;
        r5 = r8.d;
        r15 = r15.getValue();
        r15 = (java.lang.StackTraceElement[]) r15;
        r5 = r5.a(r15);
        r15 = 0;
        r5 = r8.c(r6, r5, r15);
        r14.add(r5);
        goto L_0x00dc;
    L_0x00da:
        r16 = r5;
    L_0x00dc:
        r5 = r16;
        r6 = r18;
        goto L_0x00a7;
    L_0x00e1:
        r5 = 0;
        r6 = new c.e.b.h.e.m.w;
        r6.m1796init(r14);
        r14 = 8;
        r15 = 4;
        r23 = r8.a(r10, r15, r14, r5);
        r14 = 0;
        r5 = java.lang.Long.valueOf(r14);
        if (r5 != 0) goto L_0x00f9;
    L_0x00f6:
        r10 = " address";
        goto L_0x00fb;
    L_0x00f9:
        r10 = r20;
    L_0x00fb:
        r16 = r10.isEmpty();
        r14 = "Missing required properties:";
        if (r16 == 0) goto L_0x047a;
    L_0x0103:
        r10 = new c.e.b.h.e.m.o;
        r27 = r5.longValue();
        r29 = 0;
        r25 = "0";
        r26 = "0";
        r24 = r10;
        r24.m6126init(r25, r26, r27, r29);
        r5 = 1;
        r5 = new c.e.b.h.e.m.v.d.d.a.b.a[r5];
        r15 = 0;
        r18 = java.lang.Long.valueOf(r15);
        r15 = java.lang.Long.valueOf(r15);
        r16 = r14;
        r14 = r8.c;
        r14 = r14.d;
        r32 = r11;
        r11 = "Null name";
        java.util.Objects.requireNonNull(r14, r11);
        r11 = r8.c;
        r11 = r11.b;
        if (r18 != 0) goto L_0x0137;
    L_0x0134:
        r12 = " baseAddress";
        goto L_0x0139;
    L_0x0137:
        r12 = r20;
    L_0x0139:
        r34 = r3;
        if (r15 != 0) goto L_0x0143;
    L_0x013d:
        r3 = " size";
        r12 = c.b.a.a.a.D(r12, r3);
    L_0x0143:
        r3 = r12.isEmpty();
        if (r3 == 0) goto L_0x046e;
    L_0x0149:
        r3 = new c.e.b.h.e.m.m;
        r25 = r18.longValue();
        r27 = r15.longValue();
        r31 = 0;
        r24 = r3;
        r29 = r14;
        r30 = r11;
        r24.m6124init(r25, r27, r29, r30, r31);
        r11 = 0;
        r5[r11] = r3;
        r3 = new c.e.b.h.e.m.w;
        r5 = java.util.Arrays.asList(r5);
        r3.m1796init(r5);
        r15 = new c.e.b.h.e.m.l;
        r26 = 0;
        r21 = r15;
        r22 = r6;
        r24 = r10;
        r25 = r3;
        r21.m6123init(r22, r23, r24, r25, r26);
        if (r13 != 0) goto L_0x017e;
    L_0x017b:
        r3 = " uiOrientation";
        goto L_0x0180;
    L_0x017e:
        r3 = r20;
    L_0x0180:
        r5 = r3.isEmpty();
        if (r5 == 0) goto L_0x0462;
    L_0x0186:
        r3 = new c.e.b.h.e.m.k;
        r18 = r13.intValue();
        r19 = 0;
        r5 = 0;
        r6 = r16;
        r14 = r3;
        r16 = r5;
        r14.m6122init(r15, r16, r17, r18, r19);
        r5 = r8.a;
        r5 = c.e.b.h.e.k.e.a(r5);
        r10 = r5.a;
        if (r10 == 0) goto L_0x01aa;
    L_0x01a1:
        r10 = r10.doubleValue();
        r10 = java.lang.Double.valueOf(r10);
        goto L_0x01ab;
    L_0x01aa:
        r10 = 0;
    L_0x01ab:
        r5 = r5.b();
        r11 = r8.a;
        r11 = c.e.b.h.e.k.g.l(r11);
        r12 = c.e.b.h.e.k.g.o();
        r8 = r8.a;
        r14 = new android.app.ActivityManager$MemoryInfo;
        r14.<init>();
        r15 = "activity";
        r8 = r8.getSystemService(r15);
        r8 = (android.app.ActivityManager) r8;
        r8.getMemoryInfo(r14);
        r14 = r14.availMem;
        r12 = r12 - r14;
        r8 = android.os.Environment.getDataDirectory();
        r8 = r8.getPath();
        r14 = c.e.b.h.e.k.g.a(r8);
        r8 = new c.e.b.h.e.m.r$b;
        r8.m6130init();
        r8.a = r10;
        r5 = java.lang.Integer.valueOf(r5);
        r8.b = r5;
        r5 = java.lang.Boolean.valueOf(r11);
        r8.c = r5;
        r5 = java.lang.Integer.valueOf(r9);
        r8.d = r5;
        r5 = java.lang.Long.valueOf(r12);
        r8.e = r5;
        r5 = java.lang.Long.valueOf(r14);
        r8.f = r5;
        r14 = r8.a();
        r5 = " timestamp";
        if (r4 != 0) goto L_0x0209;
    L_0x0207:
        r8 = r5;
        goto L_0x020b;
    L_0x0209:
        r8 = r20;
    L_0x020b:
        r9 = r8.isEmpty();
        if (r9 == 0) goto L_0x0458;
    L_0x0211:
        r8 = r4.longValue();
        r4 = java.lang.Long.valueOf(r8);
        r8 = r0.d;
        r8 = r8.c;
        r8 = r8.b();
        if (r8 == 0) goto L_0x022b;
    L_0x0223:
        r9 = new c.e.b.h.e.m.s;
        r10 = 0;
        r9.m6132init(r8, r10);
        r15 = r9;
        goto L_0x0232;
    L_0x022b:
        r8 = "No log data to include with this event.";
        r2.b(r8);
        r8 = 0;
        r15 = r8;
    L_0x0232:
        r8 = r0.e;
        r8 = r8.b;
        r8 = java.util.Collections.unmodifiableMap(r8);
        r9 = new java.util.ArrayList;
        r9.<init>();
        r10 = r8.size();
        r9.ensureCapacity(r10);
        r8 = r8.entrySet();
        r8 = r8.iterator();
    L_0x024e:
        r10 = r8.hasNext();
        if (r10 == 0) goto L_0x027a;
    L_0x0254:
        r10 = r8.next();
        r10 = (java.util.Map.Entry) r10;
        r11 = r10.getKey();
        r11 = (java.lang.String) r11;
        r12 = "Null key";
        java.util.Objects.requireNonNull(r11, r12);
        r10 = r10.getValue();
        r10 = (java.lang.String) r10;
        r12 = "Null value";
        java.util.Objects.requireNonNull(r10, r12);
        r12 = new c.e.b.h.e.m.c;
        r13 = 0;
        r12.m6110init(r11, r10, r13);
        r9.add(r12);
        goto L_0x024e;
    L_0x027a:
        r8 = c.e.b.h.e.k.v0.a;
        java.util.Collections.sort(r9, r8);
        r8 = r9.isEmpty();
        if (r8 != 0) goto L_0x0296;
    L_0x0285:
        r3 = r3.e();
        r8 = new c.e.b.h.e.m.w;
        r8.m1796init(r9);
        r3 = (c.e.b.h.e.m.k.b) r3;
        r3.b = r8;
        r3 = r3.a();
    L_0x0296:
        r13 = r3;
        r0 = r0.b;
        if (r4 != 0) goto L_0x029c;
    L_0x029b:
        goto L_0x029e;
    L_0x029c:
        r5 = r20;
    L_0x029e:
        r3 = r5.isEmpty();
        if (r3 == 0) goto L_0x044e;
    L_0x02a4:
        r3 = new c.e.b.h.e.m.j;
        r10 = r4.longValue();
        r16 = 0;
        r12 = "crash";
        r9 = r3;
        r9.m6119init(r10, r12, r13, r14, r15, r16);
        r4 = r0.f;
        r4 = (c.e.b.h.e.s.d) r4;
        r4 = r4.c();
        r4 = r4.a();
        r4 = r4.a;
        r5 = r0.h(r7);
        r6 = c.e.b.h.e.o.g.i;
        java.util.Objects.requireNonNull(r6);
        r6 = c.e.b.h.e.m.x.h.a;
        r6 = (c.e.b.i.i.d) r6;
        java.util.Objects.requireNonNull(r6);
        r8 = new java.io.StringWriter;
        r8.<init>();
        r6.a(r3, r8);	 Catch:{ IOException -> 0x02d8 }
    L_0x02d8:
        r3 = r8.toString();
        r0 = r0.a;
        r0 = r0.getAndIncrement();
        r6 = java.util.Locale.US;
        r8 = 1;
        r8 = new java.lang.Object[r8];
        r0 = java.lang.Integer.valueOf(r0);
        r9 = 0;
        r8[r9] = r0;
        r0 = "%010d";
        r0 = java.lang.String.format(r6, r0, r8);
        r6 = "event";
        r8 = "_";
        r0 = c.b.a.a.a.E(r6, r0, r8);
        r6 = new java.io.File;	 Catch:{ IOException -> 0x0305 }
        r6.<init>(r5, r0);	 Catch:{ IOException -> 0x0305 }
        c.e.b.h.e.o.g.l(r6, r3);	 Catch:{ IOException -> 0x0305 }
        goto L_0x031a;
    L_0x0305:
        r0 = move-exception;
        r3 = new java.lang.StringBuilder;
        r3.<init>();
        r6 = "Could not persist event for session ";
        r3.append(r6);
        r3.append(r7);
        r3 = r3.toString();
        r2.c(r3, r0);
    L_0x031a:
        r0 = c.e.b.h.e.o.c.a;
        r0 = c.e.b.h.e.o.g.g(r5, r0);
        r3 = c.e.b.h.e.o.d.a;
        java.util.Collections.sort(r0, r3);
        r3 = r0.size();
        r0 = r0.iterator();
    L_0x032d:
        r5 = r0.hasNext();
        if (r5 == 0) goto L_0x0342;
    L_0x0333:
        r5 = r0.next();
        r5 = (java.io.File) r5;
        if (r3 > r4) goto L_0x033c;
    L_0x033b:
        goto L_0x0342;
    L_0x033c:
        c.e.b.h.e.o.g.k(r5);
        r3 = r3 + -1;
        goto L_0x032d;
    L_0x0342:
        r7 = r1.e;
        r9 = r1.c;
        r10 = r1.b;
        java.util.Objects.requireNonNull(r7);
        r3 = "Failed to close fatal exception file output stream.";
        r4 = "Failed to flush to session begin file.";
        r5 = new c.e.b.h.e.p.b;	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r0 = r7.l();	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r6 = new java.lang.StringBuilder;	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r6.<init>();	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r8 = r34;
        r6.append(r8);	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r8 = "SessionCrash";
        r6.append(r8);	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r6 = r6.toString();	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r5.m1821init(r0, r6);	 Catch:{ Exception -> 0x038c, all -> 0x0387 }
        r6 = c.e.b.h.e.p.c.l(r5);	 Catch:{ Exception -> 0x0384, all -> 0x0382 }
        r13 = "crash";
        r14 = 1;
        r15 = 4;
        r8 = r6;
        r11 = r32;
        r7.y(r8, r9, r10, r11, r13, r14);	 Catch:{ Exception -> 0x037a }
        goto L_0x03a0;
    L_0x037a:
        r0 = move-exception;
        goto L_0x0392;
    L_0x037c:
        r0 = move-exception;
        goto L_0x0447;
    L_0x037f:
        r0 = move-exception;
        r15 = 4;
        goto L_0x0392;
    L_0x0382:
        r0 = move-exception;
        goto L_0x0389;
    L_0x0384:
        r0 = move-exception;
        r6 = 4;
        goto L_0x038f;
    L_0x0387:
        r0 = move-exception;
        r5 = 0;
    L_0x0389:
        r6 = 0;
        goto L_0x0447;
    L_0x038c:
        r0 = move-exception;
        r6 = 4;
        r5 = 0;
    L_0x038f:
        r7 = 0;
        r15 = r6;
        r6 = r7;
    L_0x0392:
        r7 = "An error occurred in the fatal exception logger";
        r8 = 6;
        r2 = r2.a(r8);	 Catch:{ all -> 0x037c }
        if (r2 == 0) goto L_0x03a0;
    L_0x039b:
        r2 = "FirebaseCrashlytics";
        android.util.Log.e(r2, r7, r0);	 Catch:{ all -> 0x037c }
    L_0x03a0:
        c.e.b.h.e.k.g.g(r6, r4);
        c.e.b.h.e.k.g.c(r5, r3);
        r0 = r1.e;
        r2 = r1.a;
        r2 = r2.getTime();
        r0.g(r2);
        r0 = r1.d;
        r0 = (c.e.b.h.e.s.d) r0;
        r0 = r0.c();
        r2 = r0.a();
        r2 = r2.a;
        r0 = r0.a();
        java.util.Objects.requireNonNull(r0);
        r0 = r1.e;
        r3 = 0;
        r0.f(r2, r3);
        r0 = r1.e;
        c.e.b.h.e.k.t.a(r0);
        r0 = r1.e;
        r2 = r0.m();
        r3 = r0.k();
        r4 = c.e.b.h.e.k.t.A;
        r5 = c.e.b.h.e.k.a1.a;
        r5 = new java.util.ArrayList;
        r5.<init>();
        r2 = r2.listFiles();
        r6 = c.e.b.h.e.k.a1.a;
        r3 = r3.listFiles(r6);
        r7 = 0;
        if (r2 == 0) goto L_0x03f2;
    L_0x03f1:
        goto L_0x03f4;
    L_0x03f2:
        r2 = new java.io.File[r7];
    L_0x03f4:
        if (r3 == 0) goto L_0x03f7;
    L_0x03f6:
        goto L_0x03f9;
    L_0x03f7:
        r3 = new java.io.File[r7];
    L_0x03f9:
        r2 = java.util.Arrays.asList(r2);
        r5.addAll(r2);
        r2 = java.util.Arrays.asList(r3);
        r5.addAll(r2);
        r2 = c.e.b.h.e.k.a1.c(r5, r15, r4);
        r2 = 4 - r2;
        r3 = r0.n();
        r3 = c.e.b.h.e.k.a1.b(r3, r6, r2, r4);
        r2 = r2 - r3;
        r0 = r0.l();
        r3 = c.e.b.h.e.k.t.y;
        c.e.b.h.e.k.a1.b(r0, r3, r2, r4);
        r0 = r1.e;
        r0 = r0.b;
        r0 = r0.a();
        if (r0 != 0) goto L_0x042f;
    L_0x0429:
        r0 = 0;
        r0 = c.e.a.b.b.j.d.b(r0);
        goto L_0x0446;
    L_0x042f:
        r0 = r1.e;
        r0 = r0.e;
        r0 = r0.a;
        r2 = r1.d;
        r2 = (c.e.b.h.e.s.d) r2;
        r2 = r2.a();
        r3 = new c.e.b.h.e.k.x;
        r3.m6097init(r1, r0);
        r0 = r2.l(r0, r3);
    L_0x0446:
        return r0;
    L_0x0447:
        c.e.b.h.e.k.g.g(r6, r4);
        c.e.b.h.e.k.g.c(r5, r3);
        throw r0;
    L_0x044e:
        r0 = new java.lang.IllegalStateException;
        r2 = c.b.a.a.a.D(r6, r5);
        r0.<init>(r2);
        throw r0;
    L_0x0458:
        r0 = new java.lang.IllegalStateException;
        r2 = c.b.a.a.a.D(r6, r8);
        r0.<init>(r2);
        throw r0;
    L_0x0462:
        r6 = r16;
        r0 = new java.lang.IllegalStateException;
        r2 = c.b.a.a.a.D(r6, r3);
        r0.<init>(r2);
        throw r0;
    L_0x046e:
        r6 = r16;
        r0 = new java.lang.IllegalStateException;
        r2 = c.b.a.a.a.D(r6, r12);
        r0.<init>(r2);
        throw r0;
    L_0x047a:
        r6 = r14;
        r0 = new java.lang.IllegalStateException;
        r2 = c.b.a.a.a.D(r6, r10);
        r0.<init>(r2);
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.h.e.k.y.call():java.lang.Object");
    }
}
